<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/jsp/include/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><%=system_name%> - 添加报价单产品</title>
	<%@include file="/WEB-INF/jsp/include/meta.jsp"%>
	
	<link href="<%=basePath%>css/common.css" rel="stylesheet" type="text/css" />
	<script src="<%=basePath%>js/common.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/pagebar.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/DatePicker/WdatePicker.js" defer="defer"></script>
	<script type="text/javascript" src="fram/engine.js" ></script>
	<script type="text/javascript" src="fram/util.js" ></script>
	<script type="text/javascript" src="fram/interface/supplierQuotationService.js"></script>
	
	<script type="text/javascript">
	function beforeSubmit(){			
		var supplierid=$("quotation.id").value;
		if(""==supplierid){alert("请先选择产品报价信息!");return false;}
		var supplier=$("supplier").value;
		if(""==supplier){alert("请输入供应商名称!");return false;}
		var productno=$("productNo").value;
		if(""==productno){alert("请输入产品货号!");return false;}
		
		//window.parent.submitStock();
			
		return true;
	}
	
	function browseQuotations(){
		openWindow("<%=basePath%>trade/showQuotatioinList?"+Math.random());
	}
	function openWindow(url){        
		if (navigator.appVersion.indexOf("MSIE") == -1){
			window.open(url,'newWin','modal=yes,width=510,height=440,top=200,left=300,resizable=no,depended=yes,scrollbars=no');
	        return;
	    }else{
	    	if(navigator.appVersion.match(/MSIE ([\d.]+)/)[1]=='6.0'){
	    		showModalDialog(url,window,'dialogWidth:530px;dialogHeight:490px;')
	    	}else{
	        	showModalDialog(url,window,'dialogWidth:510px;dialogHeight:440px;')
	        }
	    }
	}
	function browsBack(id,name){
		$("qlist.id").value=id;		
		if(name!=null){
			var arr = name.split("$");
			if(arr.length>0){
				$("quotation.id").value=arr[0];
			}
			if(arr.length>1){
				$("productNo").value=arr[1];
			}			
			if(arr.length>2){
				$("supplier").value=arr[2];
			}			
		}
		supplierQuotationService.getSupplierQuotationById(id,function(data){
			if(data!=null){
				$('packL').value=data.packingLong;
				$('packW').value=data.packingWidth;
				$('packH').value=data.packingHeight;
				$('cbm').value=data.packingLong*data.packingWidth*data.packingHeight/1000000;
				$('pcs').value=data.boxes;
			}			
		})
	}
	</script>
</head>

<body>
<form:form action="" method="post" name="myform" onsubmit="return beforeSubmit();">
	<table class="tabView" style="margin-top:5px">
		<tr><th width="100">选择产品信息：</th>
			<td colspan="3">
					<input type="button" onclick="javascript:browseQuotations()" value="请先添加产品信息" style="width:120px;"/>
						<input type="text" name="qlist.id" id="qlist.id"  value="${command.id}" style="display:none"/>
						<input type="text" name="quotation.id" id="quotation.id"  value="${command.quotation.id}" style="display:none"/>		
			</td>
		</tr>
		<tr><th>供应商名称：</th><td><input type="text" name="supplier" id="supplier" value="${command.supplier}"/></td>
				<th>产品货号：</th><td><input type="text" name="productNo" id="productNo" value="${command.productNo}"/>
				</td></tr>
		<tr><th>FOB价格：</th><td><input type="text" name="fob" id="fob" value="${command.fob}"/></td>
			<th>CNF价格：</th><td><input type="text" name="cnf" id="cnf" value="${command.cnf}"/></td></tr>
		<tr><th>长：</th><td><input type="text" name="packL" id="packL" value="${command.packL}"/></td>
			<th>宽：</th><td><input type="text" name="packW" id="packW" value="${command.packW}"/></td></tr>			
		<tr><th>高：</th><td><input type="text" name="packH" id="packH" value="${command.packH}"/></td>
			<th>cbm：</th><td><input type="text" name="cbm" id="cbm" value="${command.cbm}" /></td></tr>
		<tr><th>pcs：</th><td><input type="text" name="pcs" id="pcs" value="${command.pcs}"/></td>
			<th>福州交税价格：</th><td><input type="text" name="price" id="price" value="${command.price}"/></td>
		</tr>
		<tr><td colspan="2" style="text-align:right;height:"><input type="submit" value=" 提 交 " class="btn1" /></td>
			<td colspan="2" style="text-align:left;height:"><input type="reset" value=" 重置 " class="btn1" value="reset"/></td></tr>
	</table>
</form:form>
</body>
</html>
